// Copyright 2007 the original author or authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package lichen.services.menu.impl;

import lichen.entities.post.Topic;
import lichen.pages.topic.ViewTopic;
import lichen.services.menu.Menu;

/**
 * 浏览主题的菜单
 * @author jcai
 * @version $Revision: 7 $
 * @since 0.0.2
 */
public class TopicMenu implements Menu {

	
	private static final String VIEW_TOPIC_PATH="topic/view";
	private Topic _topic;
	private boolean _disabled;
	public TopicMenu(Topic topic,boolean disabled){
		this._topic = topic;
		this._disabled = disabled;
	}
	/**
	 * @see lichen.services.menu.Menu#getPageContext()
	 */
	public Object[] getPageContext() {
		
		return new Object[]{_topic,ViewTopic.FLAT_VIEW};
	}

	/**
	 * @see lichen.services.menu.Menu#getPagePath()
	 */
	public String getPagePath() {
		
		return VIEW_TOPIC_PATH;
	}

	/**
	 * @see lichen.services.menu.Menu#getPageText()
	 */
	public String getPageText() {
		
		return _topic.getTitle();
	}

	/**
	 * @see lichen.services.menu.Menu#isDisabled()
	 */
	public boolean isDisabled() {
		
		return this._disabled;
	}

}
